<?
if($_POST)
{
	if($_FILES["photo"]["name"] != "")
	{
	$newname = explode(".",$_FILES['photo']['name']);
	$newname = "logofooter.".$newname[(sizeof($newname)-1)];
	@unlink("../imgs/".$_POST['oldpic']);
	@copy($_FILES["photo"]["tmp_name"],"../imgs/".strtolower($newname));
	$v['tables'] = "";
	$v['img_function'] = "logofooter";
	$v['img_name1'] = $_POST['img_name1'];
	$v['img_link'] = $_POST['img_link'];
	$v['img_pic'] = strtolower($newname);
	$v['img_ip'] = $_SERVER['REMOTE_ADDR'];
	$chk = Q2("select * from images where img_function = 'logofooter' ");
	if(count($chk) < 1){
		Qinsert("images","",$v);
	}else{
		Qupdate("images","",$v," img_function = 'logofooter' ");
	}
	sleep(3);
	exit("<script type=\"text/javascript\">window.location='home.php?body=logofootersetting';</script>");
	}
}
?>

<p>

<img src="<?=logofootersetting()?>"  >
<?
	$lfls = Q1	("select * from images where img_function = 'logofooter' ");
?>
</p>

<p>
<fieldset>
<legend>Edit my  logo footer</legend>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<label>Image file</label><input name="photo" type="file" />
<label>Image link</label><input name="img_link" type="text" value = "<?=$lfls['img_link']?>" /><span  style = "color:green;">Ex : http://www.youtube.com</span>
<label>Image Color</label><input name="img_name1" type="text" value = "<?=$lfls['img_name1']?>" /><br /><br />
<input name="" type="submit" value="<?=btsubmit()?>" /> <span  style = "color:red;">( ความกว้าง 256px )</span>
<INPUT TYPE="hidden" name="oldpic" value="<?=logofootersetting()?>">
</form>
</fieldset>
</p>